package com.atguigu.controller;

import com.atguigu.ssm.bean.User;
import com.atguigu.ssm.service.UserService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author wk
 * @create 2021-06-07 19:58
 */
@Controller
public class UserController {
    @Autowired
    private UserService userService;
    @RequestMapping("/test/{pageNum}")
    public String test(Model model, @PathVariable("pageNum") int pageNum){
        int pageSize=4;
        PageInfo<User> pageInfo = userService.getList(pageNum, pageSize);
        model.addAttribute("pageInfo",pageInfo);
        System.out.println(pageInfo);
        return "success";
    }
}
